<template>
  <div>
    <el-form :inline="true" >
  <el-form-item label="昵称">
    <el-input v-model="nickname" placeholder="昵称"></el-input>
  </el-form-item>
  
  <el-form-item>
    <el-button type="primary" @click="onSubmit">查询</el-button>
  </el-form-item>
</el-form>
    <el-table
      :data="list"
      border
      style="width: 100%">
      <el-table-column
       
        label="头像"
        >
         <template #default="scope">
      <el-image lazy style="max-width:50px;max-height:50px;" :src="scope.row.avatar"/>
      </template>
      </el-table-column>
      <el-table-column
        prop="nickname"
        label="姓名"
        >
      </el-table-column>
      <el-table-column
        prop="score"
        label="豆子"
        >
      </el-table-column>
      <el-table-column
        prop="addtime"
        label="注册时间">
      </el-table-column>
      <el-table-column
        prop="logintime"
        label="登录时间">
      </el-table-column>
    </el-table>
    <el-pagination
    background

    @current-change="handleCurrentChange"
   
    :page-size="pagesize"
    :total="total">
  </el-pagination>
  </div>
</template>

<script>
import post from "@/post"

export default {
  data(){
    return {
      list :[],
      total:0,
      page : 1,
      pagesize:10,
      nickname:''
    }
  },
  mounted(){
    this.getList()
    
  },

  methods:{
    getList(){
      post("/user",{page:this.page,nickname:this.nickname}).then(d=>{
        this.total = d.total
        this.pagesize = d.pagesize
        this.pageall = d.pageall
        this.now = d.now
        this.list = d.list
      })
    },
   handleCurrentChange(d){
     this.page = d
     this.getList()
   },
   onSubmit(){
     this.page = 1
     this.getList()

   }
  }
}
</script>

<style scoped>

</style>

